package com.bkitclub.mobiledevcamp.horseword;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.Toast;
import android.widget.FrameLayout.LayoutParams;

import com.bkitclub.mobiledevcamp.horseword.customGUI.CustomButton;
import com.bkitclub.mobiledevcamp.horseword.util.Const;
import com.bkitclub.mobiledevcamp.horseword.util.ResourceManager;
import com.bkitclub.mobiledevcamp.horseword.util.Utils;

public class ListUserActivity extends Activity{
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
    	requestWindowFeature(Window.FEATURE_NO_TITLE);
    	this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                WindowManager.LayoutParams.FLAG_FULLSCREEN );
        super.onCreate(savedInstanceState);
        
        Utils.loadScreenSize(this);
        setContentView(R.layout.connect_screen);
        createLayout();
    }
    private void createLayout(){
    	FrameLayout mainLayout = (FrameLayout) findViewById(R.id.connect_screen_parent);
    	mainLayout.setBackgroundDrawable(new BitmapDrawable(ResourceManager.getInstance().getImage(this, "home/home.png")));
    	
    	// SELECT
		ImageView selectUser = new ImageView(this);
		Bitmap selectImg = ResourceManager.getInstance().getImage(this, "connect/select.png");
		selectUser.setImageBitmap(selectImg);
		LayoutParams selectLayout = new LayoutParams(selectImg.getWidth(), selectImg.getHeight());
		Const.setPositionConnectSelect(selectLayout);
		selectLayout.gravity = Gravity.TOP | Gravity.LEFT;
		selectUser.setLayoutParams(selectLayout);
		mainLayout.addView(selectUser);
    			
		// BTN BACK
		CustomButton btnBack = new CustomButton(this);
		btnBack.initResource(ResourceManager.getInstance().getImage(this, "connect/back.png"));
		LayoutParams btnBackLayout = new LayoutParams(btnBack.getResourceWidth(), btnBack.getResourceHeight());
		Const.setPositionConnectBack(btnBackLayout);
		btnBackLayout.gravity = Gravity.TOP | Gravity.LEFT;
		btnBack.setLayoutParams(btnBackLayout);
		mainLayout.addView(btnBack);
		
		btnBack.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				finish();
			}
		});
		
//    	FrameLayout mainLayout = (FrameLayout) findViewById(R.id.home_screen_parent);
//    	CustomButton btnPlay = new CustomButton(this);
//    	CustomButton btnExit = new CustomButton(this);
//    	
//    	btnPlay.initResource(ResourceManager.getInstance().getImage(this, "home/play.png"));
//    	btnExit.initResource(ResourceManager.getInstance().getImage(this, "home/exit.png"));
//    	
//    	FrameLayout.LayoutParams btnPlayLp = new FrameLayout.LayoutParams(btnPlay.getResourceWidth(), btnPlay.getResourceHeight());
//    	FrameLayout.LayoutParams btnExitLp = new FrameLayout.LayoutParams(btnExit.getResourceWidth(), btnExit.getResourceHeight());
//    	mainLayout.setBackgroundDrawable(new BitmapDrawable(ResourceManager.getInstance().getImage(this, "home/home.png")));
//    	Const.setPositionBtnExit(btnExitLp);
//    	Const.setPositionBtnPlay(btnPlayLp);
//    	btnExitLp.gravity = Gravity.TOP | Gravity.LEFT;
//    	btnPlayLp.gravity = Gravity.TOP | Gravity.LEFT;
//    	btnPlay.setLayoutParams(btnPlayLp);
//    	btnExit.setLayoutParams(btnExitLp);
//    	
//    	btnExit.setOnClickListener(new View.OnClickListener() {
//			
//			public void onClick(View v) {
//				// TODO Auto-generated method stub
//				System.exit(0);
//			}
//		});
//    	btnPlay.setOnClickListener(new View.OnClickListener() {
//			
//			public void onClick(View v) {
//				// TODO Auto-generated method stub
//				Intent intent = new Intent(MainScreen.this,PlayActivity.class);
//				startActivity(intent);
//			}
//		});
//    	mainLayout.addView(btnPlay);
//    	mainLayout.addView(btnExit);
    }
    
    private void listUsers(){
//    	final CharSequence[] items = {"Red", "Green", "Blue"};
//
//    	AlertDialog.Builder builder = new AlertDialog.Builder(this);
//    	builder.setTitle("Pick a color");
//    	builder.setItems(items, new DialogInterface.OnClickListener() {
//    	    public void onClick(DialogInterface dialog, int item) {
//    	        Toast.makeText(getApplicationContext(), items[item], Toast.LENGTH_SHORT).show();
//    	    }
//    	});
//    	AlertDialog alert = builder.create();
    }
}
